package com.topscomm.mms.script;

import com.topscomm.basic.exception.BusinessException;
import com.topscomm.cbo.pojo.CboApprovalNodeInsEntity;
import com.topscomm.mms.service.impl.MmsProvinceCityMatchinfoService;
import com.topscomm.pub.util.SpringUtil;
import com.topscomm.tap.ITapService;
import com.topscomm.tap.TapEntity;
import com.topscomm.tap.TapScript;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class MmsProvinceCityMatchinfoScript extends TapScript {

    /**
     * @description: // 省区地市审批结束数据回写
     * @param: [service, entity]
     * @return:
     * @author: wanghjielei
     * @date: 2022/1/12 16:49
     * @modify:
     */
    public void rewriteMmsProvinceCityMatchinfo(ITapService service, TapEntity entity) throws Exception {
        try {
            MmsProvinceCityMatchinfoService mmsProvinceCityMatchinfoService = (MmsProvinceCityMatchinfoService) SpringUtil
                    .getBean("mmsProvinceCityMatchinfoService");
            long sourceId = ((CboApprovalNodeInsEntity) entity).getSourceid();
            mmsProvinceCityMatchinfoService.rewriteMmsProvinceCityMatchinfo(sourceId);
        } catch (Exception e) {
            log.error("异常分类：{}, 异常信息：{}", e.getClass().getSimpleName(), e.fillInStackTrace());
            throw new BusinessException(e);
        }
    }
}
